package com.EVO.dao;

import com.EVO.entity.Province;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class TestJson {
    public static void main(String[] args) {
        Province province = new Province(1,"河北","冀","石家庄");
        ObjectMapper om = new ObjectMapper();
        try {
            String json = om.writeValueAsString(province);
            System.out.println("转换的json =  "+json);     //{"id":1,"name":"河北","jiancheng":"冀","shenghui":"石家庄"}
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }

    }
}
